class TakeComment extends React.Component {
    content = React.createRef();
    async addWeibo(){
        // 获取微博内容
        const content = this.content.current.value.trim();
        if(content.length===0){
            alert("请输入微博内容");
            return;
        }
        // 清空输入内容
        this.content.current.value = null;
        // 发送请求
        await this.$axios.post("/weibo",{
            content
        })

        this.props.getWeibo();// 更新微博列表

    }
    render() {
        return (
            <div className="takeComment">
                <textarea ref={this.content} name="textarea" className="takeTextField" id="tijiaoText"></textarea>
                <div className="takeSbmComment">
                    <input onClick={this.addWeibo.bind(this)} type="button" className="inputs" value=""/>
                </div>
            </div>
        );
    }
}